using MicroMsg.Common.Event;
using MicroMsg.Common.Utils;
using MicroMsg.Manager;
using MicroMsg.Plugin.Sns.Scene;
using MicroMsg.Resource.@string;
using MicroMsg.Scene;
using MicroMsg.Storage;
using MicroMsg.UI.UserContrl;
using MicroMsg.UI.Util;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Microsoft.Xna.Framework.Media;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace MicroMsg.UI.Page
{
	public class AlbumSlideView : BasePage
	{
		private const string TAG = "AlbumSlideView";
		private Contact mContact;
		private List<SnsInfo> SnsInfoList = new List<SnsInfo>();
		private List<TimeLineObject> tloList = new List<TimeLineObject>();
		private int nowIndex;
		private int nowMIndex;
		private SnsInfo nowSnsInfo;
		private TimeLineObject nowTimeLineObj;
		private CommentType commentType;
		private AddContactScene addContactScene;
		private bool bIsFirstLoad = true;
		private EventWatcher mWatchSnsInfo;
		private ApplicationBar mBar;
		private ApplicationBarIconButton PreviousIcon;
		private ApplicationBarIconButton ILikeIcon;
		private ApplicationBarIconButton CommentIcon;
		private ApplicationBarIconButton NextIcon;
		private ApplicationBarMenuItem SetPrivateButton;
		private ApplicationBarMenuItem SaveButton;
		private ApplicationBarMenuItem SendButton;
		private ApplicationBarMenuItem ExposeButton;
		private ApplicationBarMenuItem DelButton;
		public static List<string> strObjList;
		internal StackPanel LayoutRoot;
		internal Canvas ImagePanel;
		internal PanoramaSlideCtrl mPanoramaSlideCtrl;
		internal Button CommontAreaButton;
		internal StackPanel commentPanel;
		internal Image likeIcon;
		internal TextBlock likeNumBlock;
		internal Image commentIcon;
		internal TextBlock commentBlock;
		internal Image HeadImg;
		internal Image SendFailureIcon;
		internal Image PrivateIcon;
		internal SmileyText descTxt;
		private bool _contentLoaded;
		public AlbumSlideView()
		{
			this.InitializeComponent();
			base.add_Loaded(new RoutedEventHandler(this.AlbumSlideView_Loaded));
			base.add_Unloaded(new RoutedEventHandler(this.AlbumSlideView_Unloaded));
		}
		private void AlbumSlideView_Unloaded(object sender, RoutedEventArgs e)
		{
		}
		private void AlbumSlideView_Loaded(object sender, RoutedEventArgs e)
		{
			if (this.mBIsGoingToMainPageFromTombstone)
			{
				return;
			}
			if (this.bIsFirstLoad)
			{
				base.set_ApplicationBar(this.GetAppBar());
				this.InitResource();
				this.InitSlideImage();
				this.registerEvent();
				this.bIsFirstLoad = false;
			}
			if (base.get_ApplicationBar() != null && !base.get_ApplicationBar().get_IsVisible())
			{
				base.get_ApplicationBar().set_IsVisible(true);
			}
			this.OnClearTransition();
		}
		protected override void OnPageIn(object[] object_0)
		{
			if (object_0 != null && Enumerable.Count<object>(object_0) == 3)
			{
				List<SnsInfo> infoList = object_0[0] as List<SnsInfo>;
				this.nowIndex = (int)object_0[1];
				this.mContact = (object_0[2] as Contact);
				this.InitData(infoList);
				if (!ContactMgr.isContact(this.mContact) && AccountMgr.strUsrName != this.mContact.strUsrName)
				{
					this.CommontAreaButton.set_Visibility(1);
				}
			}
		}
		protected override void OnPageOut()
		{
			this.unRegisterEvent();
		}
		protected override void OnPageForward(Uri targetPage)
		{
		}
		private void InitData(List<SnsInfo> infoList)
		{
			for (int i = infoList.get_Count() - 1; i >= 0; i--)
			{
				TimeLineObject timeLine = SnsInfoMgr.getTimeLine(infoList.get_Item(i));
				if (timeLine != null && timeLine.content.nStyle == 1)
				{
					this.SnsInfoList.Insert(0, infoList.get_Item(i));
					this.tloList.Insert(0, timeLine);
				}
				else
				{
					if (i < this.nowIndex)
					{
						this.nowIndex--;
					}
				}
			}
		}
		private void InitSlideImage()
		{
			this.mPanoramaSlideCtrl.nowIndex = this.nowIndex;
			this.mPanoramaSlideCtrl.nowMIndex = 0;
			this.mPanoramaSlideCtrl.tloList = this.tloList;
			this.mPanoramaSlideCtrl.InitData();
			this.mPanoramaSlideCtrl.SlideToNextSnsInfo += new PanoramaSlideCtrl.SlideToNextSnsInfoEvent(this.mPanoramaSlideCtrl_SlideToNextSnsInfo);
			this.RefreshUI(this.nowIndex, 0);
		}
		private void mPanoramaSlideCtrl_SlideToNextSnsInfo(object sender, object object_0)
		{
			SlideLocArgs slideLocArgs = object_0 as SlideLocArgs;
			this.nowIndex = slideLocArgs.nowIndex;
			this.nowMIndex = slideLocArgs.nowMIndex;
			this.RefreshUI(this.nowIndex, this.nowMIndex);
		}
		private void InitResource()
		{
			this.likeIcon.set_Source(new ImageSourceConverter().ConvertFromString(R.theme.Sns_ImgPath_like_01) as ImageSource);
			this.commentIcon.set_Source(new ImageSourceConverter().ConvertFromString(R.theme.Sns_ImgPath_comment_01) as ImageSource);
			this.PrivateIcon.set_Source(new ImageSourceConverter().ConvertFromString(R.theme.Sns_ImgPath_SlideView_Private) as ImageSource);
			this.likeNumBlock.set_Foreground(R.theme.COMMON_BRUSH);
			this.commentBlock.set_Foreground(R.theme.COMMON_BRUSH);
			this.descTxt.Foreground = R.theme.SNS_USERPAGEITEM_DATA_BRUSH;
		}
		private void RefreshUIEXAppbar()
		{
			if (this.nowSnsInfo != null && this.nowSnsInfo.likeList != null && this.nowSnsInfo.commentList != null && this.nowTimeLineObj != null)
			{
				this.likeNumBlock.set_Text(this.nowSnsInfo.likeList.list.get_Count().ToString());
				this.commentBlock.set_Text(this.nowSnsInfo.commentList.list.get_Count().ToString());
				this.descTxt.Text = this.nowTimeLineObj.strContentDesc;
				return;
			}
		}
		private void RefreshUI(int index, int mIndex = 0)
		{
			if (index < 0 || index > this.SnsInfoList.get_Count() || index > this.tloList.get_Count())
			{
				Log.smethod_1("AlbumSlideView", string.Concat(new object[]
				{
					"index = ",
					index,
					"SnsInfoList.Count = ",
					this.SnsInfoList.get_Count(),
					"tloList.Count = ",
					this.tloList.get_Count()
				}));
				return;
			}
			this.nowSnsInfo = this.SnsInfoList.get_Item(index);
			this.nowTimeLineObj = this.tloList.get_Item(index);
			this.RefreshUIEXAppbar();
			if (index == 0 && mIndex == 0)
			{
				this.PreviousIcon.set_IsEnabled(false);
			}
			else
			{
				this.PreviousIcon.set_IsEnabled(true);
			}
			if (index == this.SnsInfoList.get_Count() - 1 && mIndex == this.tloList.get_Item(index).content.mediaList.get_Count() - 1)
			{
				this.NextIcon.set_IsEnabled(false);
			}
			else
			{
				this.NextIcon.set_IsEnabled(true);
			}
			if (this.nowTimeLineObj.strUsername == AccountMgr.strUsrName && (this.nowSnsInfo.nStatus == 4 || this.nowSnsInfo.nStatus == 2 || this.nowSnsInfo.nStatus == 1))
			{
				base.get_ApplicationBar().get_MenuItems().Clear();
				this.ILikeIcon.set_IsEnabled(false);
				this.ILikeIcon.set_Text(strings.Album_Like_Btn);
				this.CommentIcon.set_IsEnabled(false);
				if (this.nowSnsInfo.nStatus == 4)
				{
					this.SendFailureIcon.set_Visibility(0);
					this.SendFailureIcon.set_Source(new ImageSourceConverter().ConvertFromString(R.theme.Sns_ImgPath_SendError_small) as ImageSource);
				}
				if (this.nowTimeLineObj.nPrivate == 1)
				{
					this.PrivateIcon.set_Visibility(0);
					this.commentPanel.set_Visibility(1);
				}
				else
				{
					this.PrivateIcon.set_Visibility(1);
					this.commentPanel.set_Visibility(0);
				}
				this.HeadImg.set_Visibility(1);
				return;
			}
			this.RefreshAppBarMenu(this.nowTimeLineObj);
			this.SendFailureIcon.set_Visibility(1);
			if (this.nowTimeLineObj.strUsername != this.mContact.strUsrName)
			{
				this.PrivateIcon.set_Visibility(0);
				this.commentPanel.set_Visibility(1);
				this.HeadImg.set_Visibility(0);
				this.HeadImg.set_Source(HeadImgMgr.getHeadImage(this.nowTimeLineObj.strUsername, true));
				this.ILikeIcon.set_IsEnabled(false);
				this.ILikeIcon.set_Text(strings.Album_Like_Btn);
				this.CommentIcon.set_IsEnabled(false);
				return;
			}
			if (this.nowTimeLineObj.nPrivate == 1)
			{
				this.PrivateIcon.set_Visibility(0);
				this.commentPanel.set_Visibility(1);
				this.HeadImg.set_Visibility(1);
				this.ILikeIcon.set_IsEnabled(false);
				this.ILikeIcon.set_Text(strings.Album_Like_Btn);
				this.CommentIcon.set_IsEnabled(false);
				return;
			}
			this.PrivateIcon.set_Visibility(1);
			this.commentPanel.set_Visibility(0);
			this.HeadImg.set_Visibility(1);
			if (this.nowSnsInfo.nLikeFlag != 1 && !AlbumSlideView.CheckHasLikedObj(this.nowSnsInfo.strObjectID))
			{
				this.ILikeIcon.set_IsEnabled(true);
				this.ILikeIcon.set_Text(strings.Album_Like_Btn);
			}
			else
			{
				this.ILikeIcon.set_IsEnabled(true);
				this.ILikeIcon.set_Text(strings.Album_Like_Btn_Cancel);
			}
			this.CommentIcon.set_IsEnabled(true);
		}
		private void CommontAreaButton_Click(object sender, RoutedEventArgs e)
		{
			if (ContactMgr.isContact(this.mContact))
			{
				if (this.nowIndex < 0 || this.nowIndex >= this.SnsInfoList.get_Count())
				{
					return;
				}
				TimelineDetailPage.GotoThisPage(this.SnsInfoList.get_Item(this.nowIndex), null);
			}
		}
		private void registerEvent()
		{
			if (this.mWatchSnsInfo == null)
			{
				this.mWatchSnsInfo = new EventWatcher(this, this, new EventHandlerDelegate(this.OnTimeLineEvent));
				EventCenter.registerEventWatcher(EventConst.ON_STORAGE_SNSINFO_ADD, this.mWatchSnsInfo);
				EventCenter.registerEventWatcher(EventConst.ON_STORAGE_SNSINFO_MODIFY, this.mWatchSnsInfo);
				EventCenter.registerEventWatcher(EventConst.ON_STORAGE_SNSINFO_DEL, this.mWatchSnsInfo);
				EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_SNS_OPLOG_SUCCESS, this.mWatchSnsInfo);
				EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_SNS_OPLOG_ERR, this.mWatchSnsInfo);
				EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_EXPOSE_SUCCESS, this.mWatchSnsInfo);
				EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_EXPOSE_ERR, this.mWatchSnsInfo);
				EventCenter.registerEventWatcher(EventConst.ON_MGR_HEAD_IMG_READY, this.mWatchSnsInfo);
			}
		}
		private void unRegisterEvent()
		{
			if (this.mWatchSnsInfo != null)
			{
				EventCenter.removeEventWatcher(EventConst.ON_STORAGE_SNSINFO_ADD, this.mWatchSnsInfo);
				EventCenter.removeEventWatcher(EventConst.ON_STORAGE_SNSINFO_MODIFY, this.mWatchSnsInfo);
				EventCenter.removeEventWatcher(EventConst.ON_STORAGE_SNSINFO_DEL, this.mWatchSnsInfo);
				EventCenter.removeEventWatcher(EventConst.ON_NETSCENE_SNS_OPLOG_SUCCESS, this.mWatchSnsInfo);
				EventCenter.removeEventWatcher(EventConst.ON_NETSCENE_SNS_OPLOG_ERR, this.mWatchSnsInfo);
				EventCenter.removeEventWatcher(EventConst.ON_NETSCENE_EXPOSE_SUCCESS, this.mWatchSnsInfo);
				EventCenter.removeEventWatcher(EventConst.ON_NETSCENE_EXPOSE_ERR, this.mWatchSnsInfo);
				EventCenter.removeEventWatcher(EventConst.ON_MGR_HEAD_IMG_READY, this.mWatchSnsInfo);
				this.mWatchSnsInfo = null;
			}
		}
		private void OnTimeLineEvent(EventWatcher watcher, BaseEventArgs evtArgs)
		{
			if (evtArgs == null)
			{
				return;
			}
			List<SnsInfo> listObject = evtArgs.getListObject<SnsInfo>();
			EventConst mEventID = evtArgs.mEventID;
			if (mEventID <= EventConst.ON_NETSCENE_SNS_OPLOG_ERR)
			{
				switch (mEventID)
				{
				case EventConst.ON_NETSCENE_EXPOSE_SUCCESS:
					MessageBoxManager.ShowToast(strings.Lbs_PeoInfo_MsgExposeSucc, 2500, null, false);
					return;
				case EventConst.ON_NETSCENE_EXPOSE_ERR:
					MMMessageBox.Show(strings.Lbs_PeoInfo_MsgExposeFail, true, "确定");
					return;
				default:
					switch (mEventID)
					{
					case EventConst.ON_NETSCENE_SNS_OPLOG_SUCCESS:
						if (evtArgs.mObject != null)
						{
							return;
						}
						break;
					case EventConst.ON_NETSCENE_SNS_OPLOG_ERR:
						if (evtArgs.mObject != null && (uint)evtArgs.mObject == 2u)
						{
							MMMessageBox.Show(strings.Album_Make_PrivateFail, true, "确定");
							return;
						}
						break;
					default:
						return;
					}
					break;
				}
			}
			else
			{
				switch (mEventID)
				{
				case EventConst.ON_STORAGE_SNSINFO_ADD:
					break;
				case EventConst.ON_STORAGE_SNSINFO_DEL:
					this.DelSnsList(listObject);
					return;
				case EventConst.ON_STORAGE_SNSINFO_MODIFY:
					this.ModifySnsList(listObject);
					return;
				default:
				{
					if (mEventID != EventConst.ON_MGR_HEAD_IMG_READY)
					{
						return;
					}
					List<string> listObject2 = evtArgs.getListObject<string>();
					if (listObject2 != null)
					{
						for (int i = 0; i < listObject2.get_Count(); i++)
						{
							if (listObject2.get_Item(i) == this.nowTimeLineObj.strUsername)
							{
								this.HeadImg.set_Source(HeadImgMgr.getHeadImage(this.nowTimeLineObj.strUsername, true));
								return;
							}
						}
					}
					break;
				}
				}
			}
		}
		private void ModifySnsList(List<SnsInfo> infoList)
		{
			if (infoList != null && infoList.get_Count() != 0 && this.SnsInfoList != null && this.SnsInfoList.get_Count() != 0)
			{
				int i = 0;
				IL_98:
				while (i < infoList.get_Count())
				{
					for (int j = 0; j < this.SnsInfoList.get_Count(); j++)
					{
						if (infoList.get_Item(i).nLocalID == this.SnsInfoList.get_Item(j).nLocalID)
						{
							this.SnsInfoList.set_Item(j, infoList.get_Item(i));
							if (j == this.nowIndex)
							{
								this.RefreshUI(this.nowIndex, this.nowMIndex);
							}
							IL_94:
							i++;
							goto IL_98;
						}
					}
					goto IL_94;
				}
				return;
			}
		}
		private void DelSnsList(List<SnsInfo> infoList)
		{
			if (infoList != null && infoList.get_Count() != 0 && this.SnsInfoList != null && this.SnsInfoList.get_Count() != 0)
			{
				int i = 0;
				IL_8C:
				while (i < infoList.get_Count())
				{
					for (int j = this.SnsInfoList.get_Count() - 1; j >= 0; j--)
					{
						if (infoList.get_Item(i).nLocalID == this.SnsInfoList.get_Item(j).nLocalID)
						{
							this.SnsInfoList.RemoveAt(j);
							if (j < this.nowIndex)
							{
								this.nowIndex--;
							}
							IL_88:
							i++;
							goto IL_8C;
						}
					}
					goto IL_88;
				}
				return;
			}
		}
		private void GetCommentType(SnsInfo snsInfo, bool isLike = true)
		{
			if (snsInfo == null)
			{
				return;
			}
			if (isLike)
			{
				if (snsInfo.strUserName == AccountMgr.getCurAccount().strUsrName)
				{
					this.commentType = CommentType.MMSNS_COMMENT_LIKE;
					this.addContactScene = AddContactScene.MM_ADDSCENE_PF_CONTACT;
					return;
				}
				if (this.mContact == null)
				{
					this.commentType = CommentType.MMSNS_COMMENT_STRANGER_LIKE;
					this.addContactScene = AddContactScene.MM_ADDSCENE_PF_UNKNOWN;
					return;
				}
				if (ContactMgr.isContact(this.mContact))
				{
					this.commentType = CommentType.MMSNS_COMMENT_LIKE;
					this.addContactScene = AddContactScene.MM_ADDSCENE_PF_CONTACT;
					return;
				}
				this.commentType = CommentType.MMSNS_COMMENT_STRANGER_LIKE;
				if (this.mContact.nSource.get_HasValue())
				{
					this.addContactScene = (AddContactScene)this.mContact.nSource.get_Value();
					return;
				}
				this.addContactScene = AddContactScene.MM_ADDSCENE_PF_UNKNOWN;
				return;
			}
			else
			{
				if (snsInfo.strUserName == AccountMgr.getCurAccount().strUsrName)
				{
					this.commentType = CommentType.MMSNS_COMMENT_TEXT;
					this.addContactScene = AddContactScene.MM_ADDSCENE_PF_CONTACT;
					return;
				}
				if (this.mContact == null)
				{
					this.commentType = CommentType.MMSNS_COMMENT_MESSAGE;
					this.addContactScene = AddContactScene.MM_ADDSCENE_PF_UNKNOWN;
					return;
				}
				if (ContactMgr.isContact(this.mContact))
				{
					this.commentType = CommentType.MMSNS_COMMENT_TEXT;
					this.addContactScene = AddContactScene.MM_ADDSCENE_PF_CONTACT;
					return;
				}
				this.commentType = CommentType.MMSNS_COMMENT_MESSAGE;
				if (this.mContact.nSource.get_HasValue())
				{
					this.addContactScene = (AddContactScene)this.mContact.nSource.get_Value();
					return;
				}
				this.addContactScene = AddContactScene.MM_ADDSCENE_PF_UNKNOWN;
				return;
			}
		}
		private void RefreshAppBarMenu(TimeLineObject timeLineObj)
		{
			List<ApplicationBarMenuItem> list = new List<ApplicationBarMenuItem>();
			if (timeLineObj.strUsername == AccountMgr.strUsrName && timeLineObj.nPrivate == 0)
			{
				list.Add(this.SetPrivateButton);
			}
			list.Add(this.SaveButton);
			list.Add(this.SendButton);
			if (this.mContact.strUsrName == AccountMgr.getCurAccount().strUsrName)
			{
				list.Add(this.DelButton);
			}
			else
			{
				list.Add(this.ExposeButton);
			}
			base.get_ApplicationBar().get_MenuItems().Clear();
			for (int i = 0; i < list.get_Count(); i++)
			{
				base.get_ApplicationBar().get_MenuItems().Add(list.get_Item(i));
			}
		}
		private ApplicationBar GetAppBar()
		{
			this.mBar = new ApplicationBar();
			this.mBar.set_IsMenuEnabled(true);
			this.mBar.set_IsVisible(true);
			if (this.mBar != null)
			{
				this.mBar.set_BackgroundColor(((SolidColorBrush)R.theme.COMMON_APPBAR_BK_BRUSH).get_Color());
				this.mBar.set_ForegroundColor(((SolidColorBrush)R.theme.COMMON_APPBAR_FG_BRUSH).get_Color());
			}
			this.PreviousIcon = new ApplicationBarIconButton(new Uri("/Source/Plugin/Sns/Common/Resource/ico_prev.png", 2));
			this.PreviousIcon.set_Text(strings.Album_SlideView_Previous);
			this.PreviousIcon.add_Click(new EventHandler(this.PreviousIcon_Click));
			this.mBar.get_Buttons().Add(this.PreviousIcon);
			this.ILikeIcon = new ApplicationBarIconButton(new Uri("/Source/Plugin/Sns/Common/Resource/ico_like.png", 2));
			this.ILikeIcon.set_Text(strings.Album_Like_Btn);
			this.ILikeIcon.add_Click(new EventHandler(this.ILikeIcon_Click));
			this.mBar.get_Buttons().Add(this.ILikeIcon);
			this.CommentIcon = new ApplicationBarIconButton(new Uri("/Source/Plugin/Sns/Common/Resource/ico_comment.png", 2));
			this.CommentIcon.set_Text(strings.Album_Comment_Btn);
			this.CommentIcon.add_Click(new EventHandler(this.CommentIcon_Click));
			this.mBar.get_Buttons().Add(this.CommentIcon);
			this.NextIcon = new ApplicationBarIconButton(new Uri("/Source/Plugin/Sns/Common/Resource/ico_next.png", 2));
			this.NextIcon.set_Text(strings.Album_SlideView_Next);
			this.NextIcon.add_Click(new EventHandler(this.NextIcon_Click));
			this.mBar.get_Buttons().Add(this.NextIcon);
			this.SetPrivateButton = new ApplicationBarMenuItem(strings.Album_Make_Private);
			this.SetPrivateButton.add_Click(new EventHandler(this.SetPrivateButton_Click));
			this.SaveButton = new ApplicationBarMenuItem(strings.Album_SaveToPhotoLibrary);
			this.SaveButton.add_Click(new EventHandler(this.SaveButton_Click));
			this.SendButton = new ApplicationBarMenuItem(strings.Album_Forward);
			this.SendButton.add_Click(new EventHandler(this.SendButton_Click));
			this.DelButton = new ApplicationBarMenuItem(strings.COM_Del);
			this.DelButton.add_Click(new EventHandler(this.DelButton_Click));
			this.ExposeButton = new ApplicationBarMenuItem(strings.Lbs_PeoInfo_BtnExpose);
			this.ExposeButton.add_Click(new EventHandler(this.ExposeButton_Click));
			this.setAppBarStyle(this.mBar);
			return this.mBar;
		}
		private void DelButton_Click(object sender, EventArgs e)
		{
			MMMessageBox mMMessageBox;
			if (this.nowTimeLineObj.content.mediaList.get_Count() == 1)
			{
				mMMessageBox = MMMessageBox.Show(strings.Album_DeleteConfirm, null, true, strings.COM_Confirm, strings.COM_Cancel);
			}
			else
			{
				mMMessageBox = MMMessageBox.Show(strings.WC_DeleteEvent_Comfirm, null, true, strings.COM_Confirm, strings.COM_Cancel);
			}
			mMMessageBox.ReturnEvent = new DlgReturnEvent(this.OnDelSnsHandler);
		}
		private void OnDelSnsHandler(DlgReturnEventArg dlgReturnEventArg_0)
		{
			switch (MMMessageBox.GetUserClickResult(dlgReturnEventArg_0))
			{
			case 0:
				base.get_Dispatcher().BeginInvoke(delegate
				{
					this.DelNowSnsInfo();
				});
				break;
			case 1:
				break;
			default:
				return;
			}
		}
		private void DelNowSnsInfo()
		{
			int num = this.nowIndex;
			this.mPanoramaSlideCtrl.RemoveTloMediaByIndex(num);
			this.tloList.RemoveAt(num);
			SnsInfoMgr.deleteSnsObject(this.SnsInfoList.get_Item(num).nObjectID, true);
			if (this.tloList.get_Count() == 0)
			{
				base.get_Dispatcher().BeginInvoke(delegate
				{
					base.GoBack();
				});
			}
		}
		private void SetPrivateButton_Click(object sender, EventArgs e)
		{
			MMMessageBox mMMessageBox = MMMessageBox.Show(strings.Album_Make_Private, strings.Album_Make_PrivateTip, true, strings.COM_Confirm, strings.COM_Cancel);
			mMMessageBox.ReturnEvent = new DlgReturnEvent(this.OnSetPrivateHandler);
		}
		private void OnSetPrivateHandler(DlgReturnEventArg dlgReturnEventArg_0)
		{
			switch (MMMessageBox.GetUserClickResult(dlgReturnEventArg_0))
			{
			case 0:
				if (!SnsInfoMgr.setPrivate(this.SnsInfoList.get_Item(this.nowIndex).nObjectID, true, true))
				{
					MMMessageBox.Show(strings.Album_Make_PrivateFail, true, "确定");
					return;
				}
				this.nowTimeLineObj.nPrivate = 1;
				this.RefreshUI(this.nowIndex, this.nowMIndex);
				break;
			case 1:
				break;
			default:
				return;
			}
		}
		private void ExposeButton_Click(object sender, EventArgs e)
		{
			MMMessageBox mMMessageBox = MMMessageBox.Show(strings.Album_ExposeComfirm, null, true, strings.COM_Confirm, strings.COM_Cancel);
			mMMessageBox.ReturnEvent = new DlgReturnEvent(this.OnExposeHandler);
		}
		private void OnExposeHandler(DlgReturnEventArg dlgReturnEventArg_0)
		{
			switch (MMMessageBox.GetUserClickResult(dlgReturnEventArg_0))
			{
			case 0:
				ServiceCenter.sceneExpose.doScene(this.SnsInfoList.get_Item(this.nowIndex).strUserName, ExposeScene.MM_EXPOSE_ALBUM_PHOTO, 0u);
				break;
			case 1:
				break;
			default:
				return;
			}
		}
		private void SendButton_Click(object sender, EventArgs e)
		{
			string strUrl = this.nowTimeLineObj.content.mediaList.get_Item(this.nowMIndex).strUrl;
			object[] object_ = new object[]
			{
				strUrl
			};
			base.GoToPage("/Source/Plugin/Sns/Album/UI/ChooseAContactToSendImgPage.xaml", object_, false);
		}
		private void SaveButton_Click(object sender, EventArgs e)
		{
			try
			{
				MediaLibrary mediaLibrary = new MediaLibrary();
				byte[] array = SnsMediaStorage.load(this.nowTimeLineObj.content.mediaList.get_Item(this.nowMIndex).strUrl);
				Stream stream = new MemoryStream(array);
				mediaLibrary.SavePicture(this.GetExisPicName(), stream);
				stream.Seek(0L, 0);
				MessageBoxManager.ShowToast(strings.ImageViewSaveSuccess, 2500, null, false);
			}
			catch (Exception ex)
			{
				Log.smethod_1(base.GetType().get_Name(), "SavaPic Exception" + ex.get_StackTrace());
				MMMessageBox.Show(strings.ImageViewSaveFail, true, "确定");
			}
		}
		private string GetExisPicName()
		{
			return "Image" + DateTime.get_Now().get_Ticks() + ".jpg";
		}
		private void PreviousIcon_Click(object sender, EventArgs e)
		{
			this.mPanoramaSlideCtrl.GoPrevious();
		}
		private void NextIcon_Click(object sender, EventArgs e)
		{
			this.mPanoramaSlideCtrl.GoNext();
		}
		private void ILikeIcon_Click(object sender, EventArgs e)
		{
			if (this.SnsInfoList.get_Item(this.nowIndex).nLikeFlag != 1)
			{
				this.likeNumBlock.set_Text((this.SnsInfoList.get_Item(this.nowIndex).likeList.list.get_Count() + 1).ToString());
				this.ILikeIcon.set_Text(strings.Album_Like_Btn_Cancel);
				this.GetCommentType(this.SnsInfoList.get_Item(this.nowIndex), true);
				if (SnsCommentServiceCenter.snsCommentService == null)
				{
					SnsCommentServiceCenter.init();
				}
				SnsCommentServiceCenter.snsCommentService.doSendComment(this.SnsInfoList.get_Item(this.nowIndex), "", this.commentType, this.addContactScene, null, -1);
				if (this.mContact != null && !ContactMgr.isContact(this.mContact))
				{
					AlbumSlideView.AddLikedObj(this.SnsInfoList.get_Item(this.nowIndex).strObjectID);
					return;
				}
			}
			else
			{
				this.likeNumBlock.set_Text((this.SnsInfoList.get_Item(this.nowIndex).likeList.list.get_Count() - 1).ToString());
				this.ILikeIcon.set_Text(strings.Album_Like_Btn);
				SnsInfoMgr.setLikeFlag(this.SnsInfoList.get_Item(this.nowIndex).nObjectID, false, true);
				if (this.mContact != null && !ContactMgr.isContact(this.mContact))
				{
					AlbumSlideView.DelLikedObj(this.SnsInfoList.get_Item(this.nowIndex).strObjectID);
				}
			}
		}
		private void CommentIcon_Click(object sender, EventArgs e)
		{
			this.OnSetTransition();
			base.get_Dispatcher().BeginInvoke(delegate
			{
				this.GotoCommentView();
			});
		}
		private void GotoCommentView()
		{
			base.GoToPage("/Source/Plugin/Sns/Album/UI/AlbumSlideCommentView.xaml", new object[]
			{
				new DelegateComment(this.CommentPhoto)
			}, false);
		}
		private void CommentPhoto(string strComment)
		{
			this.commentBlock.set_Text((this.SnsInfoList.get_Item(this.nowIndex).commentList.list.get_Count() + 1).ToString());
			this.GetCommentType(this.SnsInfoList.get_Item(this.nowIndex), false);
			if (SnsCommentServiceCenter.snsCommentService == null)
			{
				SnsCommentServiceCenter.init();
			}
			SnsComment snsComment = new SnsComment();
			snsComment.nCommentId = 0;
			snsComment.strUserName = AccountMgr.strUsrName;
			snsComment.strContent = strComment;
			snsComment.nReplyCommentId = 0;
			snsComment.strReplyUsername = "";
			snsComment.nCreateTime = (uint)Util.getNowSeconds();
			SnsCommentServiceCenter.snsCommentService.doSendComment(this.SnsInfoList.get_Item(this.nowIndex), strComment, this.commentType, this.addContactScene, null, -1);
		}
		protected override void OnSetTransition()
		{
			TransitionService.SetNavigationOutTransition(this, new NavigationOutTransition
			{
				Forward = new SlideTransition
				{
					Mode = SlideTransitionMode.SlideDownFadeOut
				}
			});
			TransitionService.SetNavigationInTransition(this, new NavigationInTransition
			{
				Backward = new SlideTransition
				{
					Mode = SlideTransitionMode.SlideUpFadeIn
				}
			});
		}
		protected override void OnClearTransition()
		{
			TransitionService.SetNavigationInTransition(this, null);
			TransitionService.SetNavigationOutTransition(this, null);
		}
		public static bool CheckHasLikedObj(string strObjId)
		{
			if (AlbumSlideView.strObjList == null)
			{
				return false;
			}
			for (int i = 0; i < AlbumSlideView.strObjList.get_Count(); i++)
			{
				if (AlbumSlideView.strObjList.get_Item(i) == strObjId)
				{
					return true;
				}
			}
			return false;
		}
		public static void AddLikedObj(string strObjId)
		{
			if (AlbumSlideView.strObjList == null)
			{
				AlbumSlideView.strObjList = new List<string>();
			}
			AlbumSlideView.strObjList.Add(strObjId);
		}
		public static void DelLikedObj(string strObjId)
		{
			if (AlbumSlideView.strObjList != null && AlbumSlideView.strObjList.Contains(strObjId))
			{
				AlbumSlideView.strObjList.Remove(strObjId);
				return;
			}
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/Plugin/Sns/Album/UI/AlbumSlideView.xaml", 2));
			this.LayoutRoot = (StackPanel)base.FindName("LayoutRoot");
			this.ImagePanel = (Canvas)base.FindName("ImagePanel");
			this.mPanoramaSlideCtrl = (PanoramaSlideCtrl)base.FindName("mPanoramaSlideCtrl");
			this.CommontAreaButton = (Button)base.FindName("CommontAreaButton");
			this.commentPanel = (StackPanel)base.FindName("commentPanel");
			this.likeIcon = (Image)base.FindName("likeIcon");
			this.likeNumBlock = (TextBlock)base.FindName("likeNumBlock");
			this.commentIcon = (Image)base.FindName("commentIcon");
			this.commentBlock = (TextBlock)base.FindName("commentBlock");
			this.HeadImg = (Image)base.FindName("HeadImg");
			this.SendFailureIcon = (Image)base.FindName("SendFailureIcon");
			this.PrivateIcon = (Image)base.FindName("PrivateIcon");
			this.descTxt = (SmileyText)base.FindName("descTxt");
		}
	}
}
